#Hyperledger Fabric Tutorial
Explore tagged Tumblr posts
bitcofunblog · 1 year ago
Text
Table of ContentsIntroductionPython Libraries for Blockchain DevelopmentOnline Courses and Tutorials for Python Blockchain DevelopmentCommunity Resources and Forums for Python Blockchain DevelopersQ&AConclusionUnlock the Power of Blockchain with PythonIntroduction**Introduction to Resources for Learning Blockchain Development in Python** Blockchain technology has emerged as a transformative force in various industries, and Python has become a popular language for blockchain development due to its versatility, readability, and extensive library support. This introduction provides an overview of the resources available for individuals seeking to learn blockchain development in Python.Python Libraries for Blockchain Development**Resources for Learning Blockchain Development in Python** Embarking on the journey of blockchain development in Python requires a solid foundation in the fundamentals and access to comprehensive resources. This article provides a curated list of resources to empower aspiring blockchain developers with the knowledge and tools they need to succeed. **Online Courses and Tutorials:** * **Udemy:** Offers a wide range of courses covering blockchain concepts, Python implementation, and smart contract development. * **Coursera:** Provides specialized courses from top universities, including "Blockchain Technologies: Business Applications and Implementation" and "Blockchain for Developers. * **edX:** Hosts courses from MIT and IBM, such as "Blockchain Technologies: Principles and Applications" and "Blockchain for Business: An Introduction." **Documentation and Reference Materials:** * **Python Blockchain Development Documentation:** Official documentation from the Python community, covering topics like smart contract development and blockchain interactions. * **Web3.py Documentation:** Comprehensive documentation for the popular Python library for interacting with Ethereum. * **Solidity Documentation:** Reference guide for the Solidity programming language used for writing smart contracts. **Libraries and Frameworks:** * **Web3.py:** A powerful library for connecting to Ethereum nodes, sending transactions, and deploying smart contracts. * **Truffle Suite:** A framework for developing, testing, and deploying Ethereum smart contracts. * **Hyperledger Fabric:** A permissioned blockchain framework for enterprise applications, with Python support. **Community and Forums:** * **Python Blockchain Developers Group:** A dedicated online community for Python blockchain developers, offering support and knowledge sharing. * **Ethereum Stack Exchange:** A Q&A platform where developers can ask and answer questions related to Ethereum and blockchain development. * **Reddit's r/PythonBlockchain:** A subreddit for discussing Python blockchain development, sharing resources, and connecting with other developers. **Additional Resources:** * **Blockchain Developer Bootcamps:** Intensive programs that provide hands-on training in blockchain development, including Python implementation. * **Blockchain Conferences and Meetups:** Attend industry events to network with experts, learn about the latest trends, and gain insights from experienced developers. * **Open Source Projects:** Contribute to open source blockchain projects on platforms like GitHub to gain practical experience and connect with the community. By leveraging these resources, aspiring blockchain developers can acquire the necessary knowledge, tools, and support to build innovative and secure blockchain applications in Python. Remember to stay updated with the latest advancements in the field and continuously expand your skills to stay ahead in this rapidly evolving domain.Online Courses and Tutorials for Python Blockchain Development**Resources for Learning Blockchain Development in Python** Embarking on the journey of blockchain development in Python requires a solid foundation. Fortunately, there are numerous online courses and tutorials available to guide you through this exciting field.
**Online Courses** * **Coursera: Blockchain Technology Specialization** This comprehensive specialization from Coursera provides a deep dive into blockchain concepts, development, and applications. It covers topics such as cryptography, consensus mechanisms, and smart contract programming in Python. * **edX: Blockchain for Business** Offered by the University of California, Berkeley, this course focuses on the business applications of blockchain technology. It explores use cases in supply chain management, finance, and healthcare, while also teaching Python-based blockchain development. * **Udemy: The Complete Python Blockchain Course** This highly rated course on Udemy provides a hands-on approach to blockchain development in Python. It covers the fundamentals of blockchain, smart contract creation, and building decentralized applications. **Tutorials** * **Real Python: Blockchain Development with Python** Real Python offers a series of tutorials that guide you through the basics of blockchain development in Python. These tutorials cover topics such as creating a blockchain, mining blocks, and writing smart contracts. * **GeeksforGeeks: Blockchain Development in Python** GeeksforGeeks provides a comprehensive tutorial on blockchain development in Python. It covers the theoretical concepts of blockchain, as well as practical examples of building a blockchain and smart contracts. * **Medium: Building a Blockchain in Python from Scratch** This Medium article provides a step-by-step guide to building a blockchain in Python from scratch. It covers the implementation of key blockchain components, such as blocks, transactions, and consensus mechanisms. **Additional Resources** In addition to online courses and tutorials, there are other resources available to support your learning journey: * **Python Blockchain Libraries:** Libraries such as Hyperledger Fabric and Ethereum-Python provide tools and frameworks for blockchain development in Python. * **Blockchain Communities:** Joining online communities and forums dedicated to blockchain development can provide valuable insights and support. * **Documentation:** Refer to the official documentation of blockchain platforms and libraries to gain a deeper understanding of their functionality. By leveraging these resources, you can acquire the knowledge and skills necessary to become a proficient blockchain developer in Python. Remember to practice regularly, experiment with different projects, and stay updated with the latest advancements in the field.Community Resources and Forums for Python Blockchain Developers**Resources for Learning Blockchain Development in Python** Embarking on the journey of blockchain development in Python requires a solid foundation of knowledge and access to reliable resources. This article provides a comprehensive guide to the best resources available for aspiring Python blockchain developers. **Online Courses and Tutorials** * **Udemy:** Offers a wide range of courses covering various aspects of blockchain development in Python, from beginner to advanced levels. * **Coursera:** Provides specialized courses from top universities and industry experts, including courses on blockchain fundamentals and Python implementation. * **edX:** Collaborates with leading institutions to offer online courses on blockchain technology, including Python-based development. **Documentation and Reference Materials** * **Python Blockchain Development Documentation:** The official documentation from the Python community provides comprehensive information on blockchain development using Python. * **Web3.py Documentation:** A popular Python library for interacting with the Ethereum blockchain, offering detailed documentation and tutorials. * **Solidity Documentation:** The official documentation for Solidity, a programming language specifically designed for writing smart contracts on the Ethereum blockchain. **Community Resources and Forums** * **Python Blockchain
Developers Forum:** A dedicated forum for Python blockchain developers to ask questions, share knowledge, and collaborate on projects. * **Stack Overflow:** A vast online community where developers can post questions and receive answers from experts in the field. * **GitHub:** A platform for hosting and collaborating on open-source blockchain projects, providing access to code examples and best practices. **Books and Publications** * **Blockchain Development with Python:** A comprehensive guide to blockchain development using Python, covering topics from fundamentals to advanced concepts. * **Mastering Blockchain with Python:** A practical guide that focuses on building real-world blockchain applications using Python. * **Python for Blockchain Development:** A beginner-friendly book that introduces the basics of blockchain technology and Python implementation. **Additional Tips** * **Start with the basics:** Understand the underlying concepts of blockchain technology before diving into Python development. * **Practice regularly:** Build small projects to apply your knowledge and gain hands-on experience. * **Stay updated:** The blockchain landscape is constantly evolving, so keep up with the latest developments and best practices. By leveraging these resources, aspiring Python blockchain developers can acquire the necessary knowledge and skills to build innovative and secure blockchain applications. Remember to approach learning with a curious mind and a willingness to experiment, and you will be well on your way to becoming a proficient Python blockchain developer.Q&A**Question 1:** What is a recommended online course for learning blockchain development in Python? **Answer:** Blockchain Development with Python from Coursera **Question 2:** Is there a comprehensive book that covers blockchain development in Python? **Answer:** Mastering Blockchain: A Practical Guide to Building and Deploying Blockchain Applications in Python **Question 3:** What are some reputable online communities for blockchain developers using Python? **Answer:** * Python Blockchain Developers on Reddit * Blockchain Python on DiscordConclusion**Conclusion** Python offers a comprehensive ecosystem for blockchain development, with numerous resources available to facilitate learning and project implementation. From online courses and tutorials to documentation and community support, learners have access to a wealth of materials to enhance their understanding and skills in this rapidly evolving field. By leveraging these resources, individuals can effectively navigate the complexities of blockchain development in Python and contribute to the advancement of decentralized technologies.
0 notes
101blockchians · 2 years ago
Text
How To Learn About Blockchain Technology?
Learning about blockchain technology can be an exciting and rewarding journey, whether you're interested in its applications, development, or its broader implications. 
Here's a step-by-step guide to help you get started:
Understand the Basics:
Begin by grasping the fundamental concepts of blockchain. Learn what a blockchain is, how it works, and why it's significant.
Read Books and Whitepapers:
Start with books like "Mastering Bitcoin" by Andreas M. Antonopoulos or "Blockchain Basics" by Daniel Drescher. Additionally, read the original Bitcoin whitepaper by Satoshi Nakamoto.
Online Certifications and Tutorials:
Enroll in online blockchain certifications and tutorials to get structured learning. Platforms like 101 Blockchains offer a range of blockchain certifications.
Join Online Communities:
Participate in blockchain forums, subreddits, and social media groups to stay updated on the latest news and trends. Engaging in discussions can provide valuable insights.
Explore Blockchain Platforms:
Experiment with blockchain platforms such as Ethereum, Hyperledger Fabric, or Binance Smart Chain. Create your wallet, send transactions, and interact with smart contracts.
Develop Practical Skills:
If you have a technical background, delve into blockchain development. Learn languages like Solidity (for Ethereum) or study Hyperledger Fabric's smart contract development.
Attend Meetups and Conferences:
Attend local blockchain meetups and conferences to network with experts and enthusiasts. These events often feature talks and workshops.
Read Industry News:
Stay informed about the latest developments in blockchain by reading industry news websites and blogs like CoinDesk, CoinTelegraph, and the Ethereum Blog.
Subscribe to Newsletters and Podcasts:
Subscribe to blockchain newsletters and podcasts to receive regular updates and insights from industry experts.
Explore Use Cases:
Understand how blockchain is being applied across various industries, such as finance, supply chain, healthcare, and more. Explore real-world use cases to see its potential.
Hands-On Projects:
Apply your knowledge by working on personal blockchain projects. Build a simple decentralized application (DApp) or experiment with a blockchain-based business idea.
Join Open Source Communities:
Many blockchain projects are open source. Contribute to open source blockchain projects to gain practical experience and collaborate with developers.
Stay Updated on Regulations:
Be aware of the legal and regulatory aspects of blockchain, especially if you plan to work in industries like finance or healthcare.
Learn About Cryptocurrencies:
While not synonymous with blockchain, cryptocurrencies are a key application. Study how cryptocurrencies work, how to invest safely, and the role they play in the blockchain ecosystem.
Follow Thought Leaders:
Follow influential figures in the blockchain space on social media and subscribe to their blogs or YouTube channels for expert insights.
Build a Portfolio:
As you gain expertise, build a portfolio of your work, whether it's code, articles, or projects. This can help you showcase your skills to potential employers or clients.
Last Words
Remember that blockchain technology is continually evolving, so staying curious and committed to lifelong learning is essential to stay at the forefront of this field.
0 notes
deployfabricnodeblogs · 2 years ago
Text
"Comparing Hyperledger Fabric Node Deployment Services: Features, Performance, and Support"
When it comes to deploying Hyperledger Fabric nodes, organizations have the option to leverage Hyperledger Fabric node deployment services. These services provide preconfigured environments and tools that simplify the deployment process, enabling organizations to focus more on their blockchain applications rather than infrastructure management. However, with multiple deployment service providers available, it's essential to compare their features, performance, and support to make an informed decision. In this article, we will explore the key aspects to consider when comparing Hyperledger Fabric node deployment services.
Deployment Options: One of the primary factors to consider when comparing deployment services is the available deployment options. Some services offer both on-premises and cloud deployment options, providing flexibility to choose the environment that aligns with organizational preferences and requirements. Evaluate whether the service supports popular cloud providers or offers integration with existing infrastructure.
Ease of Use and User Interface: The ease of use and user interface of a deployment service play a crucial role in the overall deployment experience. Consider the intuitiveness and user-friendliness of the service's interface, as it impacts the speed and efficiency of the deployment process. Look for services that provide clear documentation, tutorials, and user guides to help users navigate through the deployment steps smoothly.
Scalability and Performance: Scalability is a vital aspect when evaluating deployment services. Consider whether the service offers scalability features to handle growing network demands. Look for features such as auto-scaling capabilities, load balancing, and support for multiple organizations or channels. Additionally, evaluate the performance metrics provided by the service, such as transaction throughput, latency, and response times, to ensure they meet your performance requirements.
Security and Compliance: Hyperledger Fabric is often used for enterprise applications, and therefore, security and compliance are critical considerations. Evaluate the security features provided by the deployment service, such as encryption, access controls, and secure network communication. Consider whether the service complies with industry standards and regulations, such as GDPR or HIPAA, if they are applicable to your use case.
Support and Documentation: Support and documentation are essential aspects to consider, especially when deploying and managing a complex system like Hyperledger Fabric. Assess the level of support provided by the deployment service, such as email, chat, or phone support, and evaluate the responsiveness and expertise of their support team. Additionally, consider the availability and quality of documentation, tutorials, and community resources to help you troubleshoot issues or seek guidance during the deployment process.
Integration with DevOps Tools: Consider whether the deployment service integrates well with popular DevOps tools and workflows. Integration with tools like Terraform, Ansible, or Kubernetes can provide greater automation and flexibility in managing the deployment lifecycle. Evaluate the compatibility and ease of integration with your existing toolchain to streamline the overall deployment and management process.
Cost and Pricing Models: Compare the cost and pricing models offered by different deployment services. Consider factors such as subscription fees, usage-based pricing, and any additional costs for support or advanced features. Assess whether the pricing aligns with your budget and growth expectations, and evaluate the value provided by the service in relation to its cost.
Community and Ecosystem: Consider the size and activity of the community and ecosystem surrounding the deployment service. A vibrant community can provide access to resources, tutorials, and best practices, as well as opportunities for networking and collaboration. Evaluate the availability of community forums, meetups, and online resources to gauge the level of community engagement and support.
In conclusion, comparing Hyperledger Fabric node deployment services requires a comprehensive evaluation of their features, performance, and support. Consider deployment options, ease of use, scalability, security, support, documentation, integration with DevOps tools, cost, and community engagement. By carefully comparing these factors, organizations can select a deployment service that best aligns with their requirements, simplifies the deployment process, and enables them to focus on developing and running their Hyperledger Fabric applications effectively.
1 note · View note
thepause · 4 years ago
Text
IBM Is Open Sourcing a Large Slice of Additional Hyperledger Fabric Code
IBM Is Open Sourcing a Large Slice of Additional Hyperledger Fabric Code
IBM is looking to get back into the blockchain business in a big way. IBM Blockchain General Manager Kareem Yusuf shares the technology company's plans to help enterprises move into the blockchain space. #cryptocurrency #digitalfinance #finance #bitcoin #crypto Subscribe to CoinDesk on YouTube: Site: Twitter: LinkedIn: Instagram: Facebook: Newsletters: CoinDesk Podcast Network: Markets Daily…
Tumblr media
View On WordPress
0 notes
akshay-09 · 6 years ago
Link
In this Hyperledger fabric tutorial you will learn what is Hyperledger fabric, Introduction to Hyperledger in Blockchain, traditional network vs Hyperledger Blockchain, Blockchain for business and problems with existing Blockchain in this Hyperledger tutorial.
Why should you watch this Hyperledger Fabric tutorial? 
 Hyperledger Fabric is a ledger, uses smart contracts, and is a system by which participants manage their transactions securely. We are offering the top Hyperledger tutorial that can be watched by anybody to learn Hyperledger fabric. Our Hyperledger tutorial has been created with extensive inputs from the industry so that you can learn Blockchain easily.
0 notes
weekinethereum · 6 years ago
Text
January 25, 2019
News and Links
Layer 1
[eth1] state rent proposal 2
[eth1] selfish mining in Ethereum academic paper. Per Casey Detrio, EIP100 changed the threshold to 27%. But since ETC doesn’t have EIP100, it’s just 5 or 10%.
[eth2] a long AMA from the Eth2 research team
[eth2] yeeth Eth2 client in Swift
[eth2] What’s new in eth2 includes Ben’s take on future of the PoW chain
[eth2] notes from last eth2 implementer call
[eth2] Vitalik’s security design rationale
[eth2] More Vitalik: Eth2 and Casper CBC video talk
[eth2] Collin Myers takes a look at the proposed economics for validators
Layer 2
Raiden on progress towards Ithaca release, which will include pathfinding and fee earning as well as monitoring. More from Loredana on building CryptoBotWars on Raiden
Magmo update: about to release their paper on Nitro, their protocol for a virtual state channel network
The case for Ethereum scaling through layer 2 solutions
Optimistic off-chain data availability from Aragon
Starkware on a layer 2 design fundamental: validity proofs vs fraud proofs. Also: its decentralized exchange using STARKs planned for testnet at end of q1.
Stuff for developers
Solidity v0.5.3
web3j v4.1.1
Web3.js v1.0.0-beta.38
Waffle v2 of its testing suite (uses ethers.js)
Celer Network’s proto3 to solidity library generator for onchain/offchain, cross-language data structures. Celer’s SDK
ERC20 meta transaction wrapper contract
“dumb contracts” that store data in the event logs
ETL pipline on AWS for security token analytics
Interacting with Ethereum using web3.py and Jupyter notebooks
Tutorial on using Embark
Tutorial: using OpenLaw agreements with dapps
OpenBazaar’s escrow framework
Etherisc opensources the code for their Generic Insurance Framework
Austin Griffith’s latest iteration of Burner Wallet sales
Deploying a front end with IPFS and Piñata SDK
Video tutorial of Slither static analyzer
Overview of formal verification projects in Ethereum
zkPoker with SNARks - explore iden3’s circom circuit
Ecosystem
Lots of charts on the bomb historically and present
Gnosis Safe is now available on iOS
A big thing in the community was r/ethtrader’s DONUT tokens. Started by Reddit as “community points” to experiment in ethtrader upvotes, the donuts can be used to buy the banner, vote in polls, and get badges. So a Reddit <> Eth token bridge was created, and DONUT traded on Uniswap. But some people preferred donuts to be used for subreddit governance, so the experiment is currently paused. That’s my take, here’s Will Warren’s take.
Decentralizing project management with the Ethereum Cat Herders
ENS permanent registrar proposals
Client releases
The Mantis client written in Scala now supports ETH and will stop supporting ETC
Enterprise
Hyperledger Fabric founder John Wolpert on why Ethereum is winning in enterprise blockchain
Levi’s jeans, Harvard SHINE and ConsenSys announce a workers well being pilot program at a factory in Mexico
Tokenizing a roomba to charge it
Correctness analysis of Istanbul BFT. Suggests it isn’t and can be improved.
Governance and Standards
Notes from last all core devs call
A postmortem on the Constantinople postponement
SNT community voting dapp v0.1 - quadratic voting system
EIP1712: disallow deployment of unused opcodes
EIP1715: Generalized Version Bits Voting for Consensus Soft and Hard Forks
ERC1723: Cryptography engine standard
ERC1724: confidential token standard
EIP1717: Defuse the bomb and lower mining reward to 1 ether
Application layer
Augur leaderboard. And Crystalball.be stats. Augur v1.10 released
Lots of action in Augur frontends: Veil buys Predictions.global, Guesser to launch Jan 29, and BlitzPredict.
A fiat-backed Korean Won is live on AirSwap
Adventureum - “a text-based, crowd-sourced, decentralised choose-your-own adventure game”
PlasmaBears is live using LoomNetwork
Kyber’s automated price reserve - a simpler though less flexible option for liquidity providers. Also, Kyber’s long-term objectives
Interviews, Podcasts, Videos, Talks
Trail of Bits and ChainSecurity discuss 1283 on Hashing It Out
Videos from Trail of Bits’ Empire Hacking
Scott Lewis and Bryant Eisenbach give the case for Ethereum on a Bitcoin podcast
Philipp Angele talk on Livepeer’s shared economies for video infrastructure
Tarun Chitra on PoS statistical modeling on Zero Knowledge
Gnosis’ Martin Köppelmann on Into the Ether
Martin Köppelmann and Matan Field on Epicenter
Tokens / Business / Regulation
If you don’t have a background in finance, MyCrypto’s learning about supplying and borrowing with Compound will be a good read.
A nice look at the original NFT: CryptoPunk
NFT License 2.0 to define what is permitted with NFT and associated art
IDEO on what NFT collectibles should learn from legacy collectibles.
Matthew Vernon is selling tokens representing 1 hour of design consulting
Caitlin Long tweetstorm about Wyoming’s crypto-friendly legislation
Crypto exchanges don’t need a money transmitter license in Pennsylvania
General
Samsung to have key store in their Galaxy S10. Pictures show Eth confirmed.
Zilliqa to launch its mainnet this week, much like Ethereum launched with Frontier
NEAR’s private testnet launches at event in SF on the 29th
Polkadot upgrades to PoC3 using GRANDPA consensus algo
Looks like Protonmail wants to build on Ethereum
Messari says Ripple drastically overstates their supply to prop up their market cap
Sia’s David Vorick on proof of work attacks
a zero knowledge and SNARKs primer
Infoworld when the Mac launched 35 years ago: do we really need this?
Have a co-branded credit card in the US? Amazon (or whoever) probably gets to see your transaction history, which means they’re probably selling it too.
Dates of Note
Upcoming dates of note (new in bold):
Jan 29-30 - AraCon (Berlin)
Jan 30 - Feb 1 - Stanford Blockchain Conference
Jan 31 - GörliCon (Berlin)
Jan 31 - Maker to remove OasisDEX and Oasis.direct frontends
Feb 2 - Eth2 workshop (Stanford)
Feb 7-8 - Melonport’s M1 conf (Zug)
Feb 7 - 0x and Coinlist virtual hackathon ends
Feb 14 - Eth Magicians (Denver)
Feb 15-17 - ETHDenver hackathon (ETHGlobal)
Feb 27 - Constantinople (block 7280000)
Mar 4 - Ethereum Magicians (Paris)
Mar 5-7 - EthCC (Paris)
Mar 8-10 - ETHParis (ETHGlobal)
Mar 8-10 - EthUToronto
Mar 22 - Zero Knowledge Summit 0x03 (Berlin)
Mar 27 - Infura end of legacy key support
April 8-14 - Edcon hackathon and conference (Sydney)
Apr 19-21 - ETHCapetown (ETHGlobal)
May 10-11 - Ethereal (NYC)
May 17 - Deadline to accept proposals for Instanbul upgrade fork
If you appreciate this newsletter, thank ConsenSys
This newsletter is made possible by ConsenSys.
Tumblr media
I own Week In Ethereum. Editorial control has always been 100% me.
If you're unhappy with editorial decisions or anything that I have written in this issue, feel free to tweet at me.
Housekeeping
Archive on the web if you’re linking to it:  http://www.weekinethereum.com/post/182313356313/january-25-2019
Cent link for the night view:  https://beta.cent.co/+3bv4ka
https link: Substack
Follow me on Twitter, because most of what is linked here gets tweeted first: @evan_van_ness
If you’re wondering “why didn’t my post make it into Week in Ethereum?”
Did you get forwarded this newsletter?  Sign up to receive the weekly email
2 notes · View notes
Text
How can you use Hyperledger fabric node deployment for enterprise applications?
Hyperledger Fabric is a powerful distributed ledger technology that can be used to create robust enterprise applications. Fabric nodes are the building blocks of Fabric, and they allow for the deployment of applications in a decentralized manner. This makes Fabric well-suited for applications that need to be horizontally scalable and fault tolerant. In this article, we will explore how you can use Fabric nodes for enterprise applications.
Hyperledger fabric nodes are ideal for enterprise applications because they provide high-performance, low-latency connectivity and storage. Fabric nodes can be used to create isolated networks that can be securely accessed by multiple applications. The nodes also have the capability to load balance traffic and support a variety of networking protocols.
Hyperledger Fabric is a Linux-based architecture that enables organizations to build blockchain applications. Fabric nodes are used to create and manage networks of nodes, which can be used to create distributed ledgers. Hyperledger Fabric provides an easy way to deploy blockchain applications, making it a popular choice for enterprise applications. Here are some tips on how you can use Hyperledger Fabric to deploy your enterprise applications:
First, you need to decide what type of application you want to build using Hyperledger Fabric. For example, Hyperledger Fabric is ideal for financial services applications, IoT applications and supply chain management. These are a few examples of how you can use Hyperledger Fabric to make your enterprise application more secure and scalable. In this tutorial, we will focus on how you can use Hyperledger Fabric node deployment to deploy enterprise applications.
Hyperledger Fabric is a blockchain platform that is being used by many organizations for enterprise applications. It was created by the Linux Foundation, and it allows for the creation of decentralized applications. Hyperledger Fabric nodes can be deployed in a variety of ways, and this article will show how to create a blockchain node deployment for enterprise applications using Hyperledger Fabric.
First, you need to decide which type of node you want to deploy: client or server. Client nodes are used to access the blockchain network, while server nodes are responsible for running the actual blockchain technology. If you want to create a distributed application using Hyperledger Fabric, then you will need at least one client node and one server node.
Next, you need to install Hyperledger Fabric on your computer. You can download the Hyperledger Fabric client from the following link: https://www.hyperledger.org/downloads/. Open the Hyperledger Fabric client and click on Create -> New Project. The project wizard will then walk you through how to add components to your new project. You will need to select the following components: Fabric
The fabric component is used to connect with different Hyperledger projects.
The fabric component is used to connect with different Hyperledger projects. Application
The application is used to represent a distributed application. Enterprise applications are increasingly relying on distributed ledger technology (DLT) to process transactions and automate processes. Hyperledger fabric is a blockchain technology that enables organizations to build scalable, modular applications. Fabric nodes can be used to deploy these applications, making it an ideal platform for enterprise use. Here are a few tips for using Hyperledger fabric nodes for enterprise applications:
1. Choose a suitable blockchain platform: Fabric is built on the Hyperledger Fabric v1.0. 0. It’s a modular blockchain platform that supports many different use cases and allows developers to build distributed applications on top of it. For an enterprise application, you should choose the IoT or Hyperledger Fabric v1.0.0-based option. 2. Choose the right version of Hyperledger Fabric There are two options when choosing a version of the Hyperledger Fabric blockchain platform. The first option is to choose a blockchain-based solution based on one of these versions: v1.0, v1.0. 1, v1.0.2, v1.0.3 or v1.0.4; the second option is to choose a blockchain-based solution based on the Hyperledger Fabric blockchain platform version 1.1 (Hyperledger Fabric v1.1).
1 note · View note
Text
The most advantageous use cases for Hyperledger fabric nodes!
Hyperledger Fabric (HLF) is becoming the standard for distributed ledger technology. Enterprises are starting to adopt it as its capabilities grow in line with the needs of modern business. Hyperledger Fabric is a blockchain platform that allows for the creation of smart contracts and decentralized applications. While it was designed to be used in conjunction with other blockchain technologies, Hyperledger Fabric can also be used standalone.
 One of the most advantageous uses for Hyperledger Fabric nodes is as part of a private network. This is useful for businesses that want to create their own blockchain without having to share data with others. Additionally, this type of network can be used for testing purposes before deploying the technology on a larger scale. There are many reasons why organizations may want to deploy Hyperledger fabric nodes. In this article, we will highlight the most advantageous use cases for these nodes. We will also provide a brief tutorial on how to set up a Hyperledger fabric node.
 In the world of business, there are always new ways to improve efficiency and effectiveness. Hyperledger Fabric, a blockchain platform offered by The Linux Foundation, is no exception. One potential use for this technology is in the field of logistics. Here are six advantageous use cases for Hyperledger Fabric nodes:
 1. Logistics: A Hyperledger Fabric node could be used to track shipments throughout the supply chain, from manufacturer to distributor to retailer. This would allow companies to optimize their processes and reduce waste.
 2. Trade finance Logistics could also be used to track the movement of money as it moves through a supply chain. The system can help ensure that funds only move where they are supposed to, and that they are not being embezzled or misused.
3. Supply chain management Hyperledger Fabric nodes can also be used to track items as they move through a supply chain. This would allow companies to reduce waste, and increase productivity by tracking the exact location of products throughout their lifecycle. 
4. Supply chain finance Hyperledger Fabric nodes can be used to track financial transactions throughout a supply chain. This would allow companies to reduce waste by making payments only where needed and at the right time, and it would also enable them to monitor their supplier's financial health.
5. Supply chain finance Hyperledger Fabric nodes can also be used to track payments as they move through a supply chain, which enables companies to reduce waste by making payments only where needed and at the right time, and it would also enable them to monitor their supplier's financial health.
 The Hyperledger Fabric is a blockchain framework that can be used for a variety of applications. In this article, we will explore some of the most advantageous use cases for Hyperledger fabric nodes. These include creating and managing smart contracts, issuing and trading cryptocurrencies, and more. Hyperledger fabric nodes are ideal for organizations looking to build and deploy blockchain applications. Here are six of the most advantageous use cases for Hyperledger fabric nodes:
1. Building a private blockchain: A Hyperledger fabric node can be used to create a private blockchain that is secured by the peer-to-peer network.
2. Securing data: Hyperledger fabric nodes can be used to securely store data within the network.
3. Enabling smart contracts: Hyperledger fabric nodes can be used to create and execute smart contracts. 4. Creating a public blockchain  Hyperledger fabric nodes can be used to create a blockchain that is publicly accessible.  5. Enhancing existing blockchains  Hyperledger fabric nodes can be used to enhance existing blockchains, such as Bitcoin or Ethereum. 6. Creating hybrid blockchains  Hyperledger fabric nodes can be used to create hybrid blockchains that combine elements of public and private blockchain technologies.
1 note · View note
globalmediacampaign · 5 years ago
Text
Keeping data private with private data collections on Amazon Managed Blockchain
With the Amazon Managed Blockchain release of Hyperledger Fabric (HLF) version 1.4 support, the private data collections feature is also officially supported. Before HLF 1.2, the channels feature was the primary way to control data privacy amongst a set of members. But channels have significant limitations: Ordering service nodes still have a copy of all data sent through a channel so that the organizations who run the ordering nodes potentially can get access to a channel data even if their other nodes are not part of that channel. Data can’t be shared across the channels because a single transaction can’t modify two or more channels’ ledgers at the same time, making an exchange of digital assets harder to implement. The private data collection feature provides a more granular and secure way to share data amongst a subset of members in the same channel. Unlike with channels, the ordering service receives only a hash of data that was created or modified by chaincode in the private data collection. Also, transactions can modify multiple data items in different private data collections controlled by a single chaincode or multiple chaincodes using chaincode intercommunication. In this post, we walk through setting up a new channel supporting the private data collections feature and using a sample application to test its data dissemination and data retention capabilities. Every private data collection has a policy, similar to endorsement policies for chaincode, that specifies which organizations are allowed to get a copy of the data and for how long they can store it. One of the goals was to avoid sending private data to any peers of organizations that weren’t specified in the policy, including the orderers. To achieve this goal, private data stored in a private data collection is disseminated through a peer-to-peer gossip protocol, while leaving only a hash of a value in the data sent to the orderers. For gossip protocol to work across the organizations, every organization has to specify one or multiple anchor peers in a shared channel configuration. Only then can peers from different organizations discover each other to communicate. Because private data collections and other useful services like service discovery require anchor peers to have already been declared, it’s recommended that all channel members specify anchor peers as part of their initial channel configuration. Solution overview The best way to follow this post is to first complete the tutorial Get Started Creating a Hyperledger Fabric Blockchain Network Using Amazon Managed Blockchain and add anchor peers from both organizations to the joint channel “ourchannel”. For instructions, see Add an Anchor Peer to a Channel. After the channel is joined by the peers from both organizations and anchor peers are configured to facilitate gossip protocol between them, you’re ready to test a sample chaincode with private data collection support. We install and instantiate a sample chaincode called “marbles02_private”, which uses a private data collection to keep private a portion of the data submitted by the user. Then we run some tests to see how private data in the private data collection gets disseminated across the peers and how it gets automatically deleted based on the policy we set up. Let’s get started! Prerequisites Before you start, make sure you have Managed Blockchain set up for the Hyperledger Fabric 1.4 network with two members. For instructions, see Get Started Creating a Hyperledger Fabric Blockchain Network Using Amazon Managed Blockchain. Each member in your network should have the following: A Hyperledger Fabric client configured on an Amazon Elastic Compute Cloud (Amazon EC2) instance with cloned Hyperledger Fabric samples and the jq tool installed (to install, it run sudo yum install jq ). At least one peer node. A joint channel called “ourchannel”, created with enabled features of the latest versions. Peers of both organizations have joined the joint channel “ourchannel”. At least one peer from both organizations is configured as an anchor peer on “ourchannel”. For instructions, see Add an Anchor Peer to a Channel. Testing restricted private data dissemination The sample chaincode we test allows you to create and transfer digital marbles with public properties like “colour” and “name” and private properties like “price”. For this step, we set different policies in data collection configurations for public and private data collections. Then we query marble data from both collections (called “collectionMarbles” and “collectionMarblePrivateDetails”  in this use case) to verify that marble price is available only for one member called Org1. We use a sample chaincode called “marbles02_private”, which has two data collections: “collectionMarbles”, whose policy allows both members Org1 and Org 2 to keep the data, and “collectionMarblePrivateDetails”, whose policy restricts data dissemination to Org1 only. On the Org1 EC2 client instance, modify “fabric_samples/chaincode/marbles02_private/collections_config.json” to include both member IDs into the public policy and only member ID of Org1 into the private data collection policy (see the following code). Additionally, set the value of “blockToLive” to “5” to instruct all peers to delete the data after five more blocks are created in the channel. We test that feature in a later step. [ { "name": "collectionMarbles", "policy": "OR('.member', '.member')", "requiredPeerCount": 0, "maxPeerCount": 3, "blockToLive":1000000, "memberOnlyRead": true }, { "name": "collectionMarblePrivateDetails", "policy": "OR('.member')", "requiredPeerCount": 0, "maxPeerCount": 3, "blockToLive": 5, "memberOnlyRead": true } ]   On both Org1 and Org2 EC2 client instances, install the sample chaincode with private data collection support on peers: docker exec cli peer chaincode install -n marblespriv1 -v 1.0 -p github.com/marbles02_private/go/ On the Org1 EC2 client instance, instantiate the chaincode with private data collection support: docker exec cli peer chaincode instantiate -o $ORDERER -C ourchannel -n marblespriv1 -v 1.0 -c '{"Args":["init"]}' --cafile /opt/home/managedblockchain-tls-chain.pem --tls --collections-config /opt/gopath/src/github.com/marbles02_private/collections_config.json -P "OR ('.member', '.member')" On the Org1 EC2 client instance, create a new marble in the private data collection, using only a peer of Org1 for endorsement: export MARBLE=$(echo -n "{"name":"marble1","color":"blue","size":35,"owner":"tom","price":99}" | base64 | tr -d n) docker exec cli peer chaincode invoke -C ourchannel -n marblespriv1 -c '{"Args":["initMarble"]}' --peerAddresses : --tlsRootCertFiles /opt/home/managedblockchain-tls-chain.pem --transient "{"marble":"$MARBLE"}" -o $ORDERER --cafile /opt/home/managedblockchain-tls-chain.pem –tls Both Org1 and Org2 should be able to read non-private data of the collection. See the following command: docker exec cli peer chaincode query -C ourchannel -n marblespriv1 -c '{"Args":["readMarble","marble1"]}' The private data collection policy collectionMarblePrivateDetails allows only Org1 to have access to private properties of a marble, such as its price. The following command querying the marble’s private properties works on the Org1 client and doesn’t work on the Org2 client: docker exec cli peer chaincode query -C ourchannel -n marblespriv1 -c '{"Args":["readMarblePrivateDetails","marble1"]}' On Org1, you should get private marbles data like the following code: {"docType":"marblePrivateDetails","name":"marble1","price":99} On Org2, you get an error similar to the following message: Error: endorsement failure during query. response: status:500 message:"{"Error":"Failed to get private details for marble1: GET_STATE failed: transaction ID: e5dd7a53c86fc0cae54b29cb28f298b724cef73d298d724bb507beb385469c84: tx creator does not have read access permission on privatedata in chaincodeName:marblespriv1 collectionName: collectionMarblePrivateDetails"}"  Testing expansion of private data dissemination to the second organization Now let’s test what happens if we add Org2 into our policy for “collectionMarblePrivateDetails” collection of our chaincode. After editing the data collections configuration file, we install a new version for our chaincode and upgrade it with a new config. On the Org1 EC2 client instance, modify “fabric_samples/chaincode/marbles02_private/collections_config.json” to add Org2 to the private collection: [ { "name": "collectionMarbles", "policy": "OR('['.member', '.member')", "requiredPeerCount": 0, "maxPeerCount": 3, "blockToLive":1000000, "memberOnlyRead": true }, { "name": "collectionMarblePrivateDetails", "policy": "OR('.member', '.member')", "requiredPeerCount": 0, "maxPeerCount": 3, "blockToLive":5, "memberOnlyRead": true } ] On both Org1 and Org2 EC2 client instances, install a new version of the sample chaincode with private data collection support on peers: docker exec cli peer chaincode install -n marblespriv1 -v 1.1 -p github.com/marbles02_private/go/ On the Org1 EC2 client instance, instantiate the chaincode with private data collection support: docker exec cli peer chaincode upgrade -o $ORDERER -C ourchannel -n marblespriv1 -v 1.1 -c '{"Args":["init"]}' --cafile /opt/home/managedblockchain-tls-chain.pem --tls --collections-config /opt/gopath/src/github.com/marbles02_private/collections_config.json -P "OR ('.member','.member')" On the Org1 EC2 client instance, create a new marble in the private data collection, using only a peer of Org1 for endorsement: export MARBLE=$(echo -n "{"name":"marble2","color":"blue","size":35,"owner":"tom","price":99}" | base64 | tr -d n) docker exec cli peer chaincode invoke -C ourchannel -n marblespriv1 -c '{"Args":["initMarble"]}' --peerAddresses : --tlsRootCertFiles /opt/home/managedblockchain-tls-chain.pem --transient "{"marble":"$MARBLE"}" -o $ORDERER --cafile /opt/home/managedblockchain-tls-chain.pem –tls We should be able to retrieve private data of “marble2” on both Org1 and Org2 now because of the upgraded collection policy. See the following code: docker exec cli peer chaincode query -C ourchannel -n marblespriv1 -c '{"Args":["readMarblePrivateDetails","marble2"]}' We should also be able to retrieve private data of “marble1” on Org2 because of the upgraded collection policy. See the following code: docker exec cli peer chaincode query -C ourchannel -n marblespriv1 -c '{"Args":["readMarblePrivateDetails","marble1"]}' Testing that early records are removed from the private data collection In addition to keeping the marble price property private, we want to make sure it’s eventually deleted. That way we allow marble holders to create limited sales offers for small group of organizations. To achieve that, we set the “blockToLive” parameter of the private data collection config to “5” in an earlier step, so that after five blocks, the price is “forgotten” by all the peers. That way, the owner is assured that a special sales price is set for a limited period only. On the Org1 EC2 client instance, create three more marbles in the private data collection, using only a peer of Org1 for endorsement: for i in $(seq 3 6); do export MARBLE=$(echo -n "{"name":"marble${i}","color":"blue","size":35,"owner":"tom","price":99}" | base64 | tr -d n) docker exec cli peer chaincode invoke -C ourchannel -n marblespriv1 -c '{"Args":["initMarble"]}' --peerAddresses : --tlsRootCertFiles /opt/home/managedblockchain-tls-chain.pem --transient "{"marble":"$MARBLE"}" -o $ORDERER --cafile /opt/home/managedblockchain-tls-chain.pem --tls # Sleeping few seconds to ensure we create new block per transaction sleep 3s done The following command should work on both Org1 and Org2 EC2 client instances: docker exec cli peer chaincode query -C ourchannel -n marblespriv1 -c '{"Args":["readMarblePrivateDetails","marble4"]}' Because we added five blocks since marble1 was created, both Org1 and Org2 should automatically delete marble1 according to the policy. Therefore, we shouldn’t be able to retrieve it on Org1 or Org2 EC2 client instances. See the following code: docker exec cli peer chaincode query -C ourchannel -n marblespriv1 -c '{"Args":["readMarblePrivateDetails","marble1"]}' You should get the following error message: Error: endorsement failure during query. response: status:500 message:"{"Error":"Marble private details does not exist: marble1"}" Conclusion In this post, we learned how to control data dissemination and retention with private data collections, and the role of anchor peers in this process. We configured a private data collection policy for a sample chaincode and installed it on both peers of two different organizations and instantiated on the joint channel. Then we created a marble with private data initially available only for one organization and made it available to a second organization by changing the private data collection policy and redeploying the sample chaincode. Then we generated more transactions and tested that according to the policy, after five blocks, private data that needs to be forgotten is deleted and no longer available on peers. For more information about private data collection, see the following: Using Private Data in Fabric Private Data Collection (Collection) We hope you found this post useful; happy building on AWS! About the Author Nikolay Vlasov is a Senior Blockchain Architect with AWS Professional Services. Being part of a Global Speciality Practice team, he helps clients worldwide to turn their ideas into Pilots, Minimally Viable Products, and Production-ready systems based on blockchain technology.       Gitesh Tyagi is a Senior Software Development Engineer with Amazon Managed Blockchain at AWS based in Seattle. https://aws.amazon.com/blogs/database/keeping-data-private-with-private-data-collections-on-amazon-managed-blockchain/
0 notes
adaz3d · 5 years ago
Text
The Basics of Blockchain & HyperLedger Fabric
Tumblr media
The Basics of Blockchain & HyperLedger Fabric | Size: 1.18 GB
source https://www.adaz3d.com/tutorial/programming/7217-the-basics-of-blockchain-hyperledger-fabric.html
0 notes
johnkite7 · 6 years ago
Link
The hyperledger got huge community support and a wide variety of tutorials, but still, developers around the world are struggling to install and instantiate smart contract.
0 notes
awsexchage · 6 years ago
Photo
Tumblr media
AWS Cloud Development Kit(AWS CDK)でカスタムリソース(@aws-cdk/custom-resources)をつかってみた https://ift.tt/2PebWRw
AWS Cloud Development Kit(AWS CDK)でカスタムリソース(@aws-cdk/custom-resources)をつかってみた
先日AWS Cloud Development Kit(AWS CDK)がGAされたので、なにができるのかソースを眺めたり使ってみたりしていたところ、面白そうなパッケージをみつけたのでお試ししていました。
AWS Cloud Development Kit(AWS CDK)とは
AWS クラウド開発キット (CDK) – TypeScript と Python 用がご利用可能に | Amazon Web Services ブログ https://aws.amazon.com/jp/blogs/news/aws-cloud-development-kit-cdk-typescript-and-python-are-now-generally-available/
Infrastructure as Code によって、手動での実行手順に頼る代わりに、管理者と開発者の両方が構成ファイルを使用し、アプリケーションに必要なコンピューティング、ストレージ、ネットワーク、アプリケーションサービスのプロビジョニングを自動化できるようになります。
AWS CloudFormation(CFn)を利用するとYAMLやJSONでインフラストラクチャの管理ができますが、それを発展させてインフラストラクチャの管理もプログラミングしようぜって感じのやつです。 詳細は上記ブログでだいたいわかるかと思います。
AWS CDKを利用してインフラストラクチャを定義する場合、リソースごとにパッケージをインストールして実装します。 下記はaws-samples/aws-cdk-examplesリポジトリにあるサンプルでLambda関数とスケジュール起動させるためのAmazon CloudWatch Eventsのリソースを定義しています。package.jsonをみると@aws-cdk/aws-events, @aws-cdk/aws-events-targets,@aws-cdk/aws-lambdaが別途インストールされていることが確認できます。Python 2.7を指定しているのがむず痒いですね
aws-cdk-examples/index.ts at master · aws-samples/aws-cdk-examples https://github.com/aws-samples/aws-cdk-examples/blob/master/typescript/lambda-cron/index.ts
import events = require('@aws-cdk/aws-events'); import targets = require('@aws-cdk/aws-events-targets'); import lambda = require('@aws-cdk/aws-lambda'); import cdk = require('@aws-cdk/core'); import fs = require('fs'); export class LambdaCronStack extends cdk.Stack { constructor(app: cdk.App, id: string) { super(app, id); const lambdaFn = new lambda.Function(this, 'Singleton', { code: new lambda.InlineCode(fs.readFileSync('lambda-handler.py', { encoding: 'utf-8' })), handler: 'index.main', timeout: cdk.Duration.seconds(300), runtime: lambda.Runtime.PYTHON_2_7, }); // Run every day at 6PM UTC // See https://docs.aws.amazon.com/lambda/latest/dg/tutorial-scheduled-events-schedule-expressions.html const rule = new events.Rule(this, 'Rule', { schedule: events.Schedule.expression('cron(0 18 ? * MON-FRI *)') }); rule.addTarget(new targets.LambdaFunction(lambdaFn)); } } const app = new cdk.App(); new LambdaCronStack(app, 'LambdaCronExample'); app.synth();
package.json
{ "name": "lambda-cron", (略) "dependencies": { "@aws-cdk/aws-events": "*", "@aws-cdk/aws-events-targets": "*", "@aws-cdk/aws-lambda": "*", "@aws-cdk/core": "*" } }
こんな感じでこれまでYAMLやJSONでテンプレート定義してスタック管理していたのをプログラミングに落とし込めるのがAWS CDKです。
面白そうなパッケージ
aws-cdkリポジトリのソースを眺めていたら@aws-cdk/custom-resourcesというパッケージがありました。
aws-cdk/packages/@aws-cdk/custom-resources at master · aws/aws-cdk https://github.com/aws/aws-cdk/tree/master/packages/%40aws-cdk/custom-resources
名前のとおりカスタムリソースのパッケージですが、CFnのいわゆるカスタムリソースのパッケージは別にあり、利用用途が少し異なるものでした。
こちらがCFnのいわゆるカスタムリソースのパッケージ aws-cdk/packages/@aws-cdk/aws-cloudformation at master · aws/aws-cdk https://github.com/aws/aws-cdk/tree/master/packages/%40aws-cdk/aws-cloudformation
単にカスタムリソースの使い方を調べていて先に@aws-cdk/custom-resourcesに目がいったという。。。
@aws-cdk/custom-resourcesのREADMEの冒頭で
This is a developer preview (public beta) module. Releases might lack important features and might have future breaking changes.
This API is still under active development and subject to non-backward compatible changes or removal in any future version. Use of the API is not recommended in production environments. Experimental APIs are not subject to the Semantic Versioning model.
とあり、AWS CDKはGAされたにも関わらず、絶賛開発中のパッケージです。(2019/07/23時点)
サンプルをみてみるとCFnのカスタムリソースをより簡単に実装できるようにするためのパッケージみたいです。 Lambda関数がでてこない!
サンプル
const verifyDomainIdentity = new AwsCustomResource(this, 'VerifyDomainIdentity', { onCreate: { service: 'SES', action: 'verifyDomainIdentity', parameters: { Domain: 'example.com' }, physicalResourceIdPath: 'VerificationToken' // Use the token returned by the call as physical id } }); new route53.TxtRecord(zone, 'SESVerificationRecord', { recordName: `_amazonses.example.com`, recordValue: verifyDomainIdentity.getData('VerificationToken') });
つかってみた
CFnのカスタムリソースといえば、先日散々苦労してCFnのテンプレートを作成したAmazon Managed Blockchain(AMB)しかおもい浮かばなかったのでお題にしてみます。
苦労したやつはこちら
Amazon Managed BlockchainでHyperledger Fabricのブロックチェーンネットワークをさくっと構築するAWS CloudFormationのテンプレートを作ってみた(使い方編) – Qiita https://cloudpack.media/48077
Amazon Managed BlockchainでHyperledger Fabricのブロックチェーンネットワークをさくっと構築するAWS CloudFormationのテンプレートを作ってみた(解説編) – Qiita https://cloudpack.media/48440
前提
AWSアカウントがある
AWS CLIが利用できる
Node.jsがインストール済み
AWS CDKのインストール
AWS CDKのコマンドが利用できるようにするため、aws-cdkをインストールします。
> node -v v10.11.0 > npm -v 6.10.1 > npm i -g aws-cdk # fishの場合 > exec fish -l > cdk --version 1.1.0 (build 1a11e96)
AWS CDKプロジェクト作成
cdkコマンドでプロジェクトを作成します。言語はTypeScriptを利用します。
> mkdir use-cdk-custom-resources > cd use-cdk-custom-resources > cdk init app --language=typescript Applying project template app for typescript Initializing a new git repository... Executing npm install... npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN [email protected] No repository field. npm WARN [email protected] No license field. # Useful commands * `npm run build` compile typescript to js * `npm run watch` watch for changes and compile * `cdk deploy` deploy this stack to your default AWS account/region * `cdk diff` compare deployed stack with current state * `cdk synth` emits the synthesized CloudFormation template
cdk initコマンドを実行すると以下のようにファイルが自動生成されました。 コマンド実行したディレクト���の名前が反映されました。
> tree . -L 2 . ├── README.md ├── bin │ └── use-cdk-custom-resources.ts ├── cdk.json ├── lib │ └── use-cdk-custom-resources-stack.ts ├── node_modules (略) ├── package-lock.json ├── package.json └── tsconfig.json 3 directories, 5 files
@aws-cdk/custom-resourcesのインストール
@aws-cdk/custom-resourcesをインストールして利用できるようにします。
> npm i @aws-cdk/custom-resources + @aws-cdk/[email protected] added 19 packages from 4 contributors and audited 939 packages in 170.2s found 0 vulnerabilities
実装する
@aws-cdk/custom-resourcesパッケージのAwsCustomResourceを利用して既存のAMBネットワーク情報を取得するカスタムリソースを実装してみました。 取得した情報をcdk.CfnOutputでCFnスタックのアウトプットとします。
AMBのネットワークがないって方は下記を参考に構築してみてください。
Amazon Managed BlockchainでHyperledger Fabricのブロックチェーンネットワークをさくっと構築するAWS CloudFormationのテンプレートを作ってみた(使い方編) – Qiita https://cloudpack.media/48077
実装はcdk initコマンドで自動生成されたlib/use-cdk-custom-resources-stack.tsに行います。
lib/use-cdk-custom-resources-stack.ts
import cdk = require('@aws-cdk/core'); import { AwsCustomResource } from '@aws-cdk/custom-resources/lib'; export class UseCdkCustomResourcesStack extends cdk.Stack { constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { super(scope, id, props); const getNetworkTest = new AwsCustomResource(this, 'getNetworkTest', { onCreate: { apiVersion: '2018-09-24', // 指定しなくてもOK service: 'ManagedBlockchain', action: 'getNetwork', parameters: { NetworkId: 'n-XXXXXXXXXXXXXXXXXXXXXXXXXX' }, physicalResourceIdPath: 'Network.Id' } }); new cdk.CfnOutput(this, 'BcNetworkId', { description: 'The message that came back from the Custom Resource', value: getNetworkTest.getData('Network.Id').toString() }); } }
ビルドしてデプロイする
実装できたらビルドしてデプロイします。
> npm run build > [email protected] build /Users/kai/dev/aws/cdk/use-cdk-custom-resources > tsc
AWS CDKで初回デプロイ時にcdk bootstrapコマンドを実行する必要がありました。 実行するとCFnにCDKToolkitというスタックが作成されてリソースとしてS3バケットが作成されました。 --profileオプションでAWSアカウントを指定する必要があります。こちらはAWS CLIと同じ設定をみてくれます。
> cdk bootstrap --profile default
⏳ Bootstrapping environment aws://xxxxxxxxxxxx/us-east-1... CDKToolkit: creating CloudFormation changeset... 0/2 | 16:11:40 | CREATE_IN_PROGRESS | AWS::S3::Bucket | StagingBucket 0/2 | 16:11:41 | CREATE_IN_PROGRESS | AWS::S3::Bucket | StagingBucket Resource creation Initiated 1/2 | 16:12:02 | CREATE_COMPLETE | AWS::S3::Bucket | StagingBucket 2/2 | 16:12:05 | CREATE_COMPLETE | AWS::CloudFormation::Stack | CDKToolkit ✅ Environment aws://xxxxxxxxxxxx/us-east-1 bootstrapped.
CDKToolkitスタック情報を確認するとS3バケットが作成されたのを確認できます。
> aws cloudformation describe-stacks \ --stack-name CDKToolkit { "Stacks": [ { "StackId": "arn:aws:cloudformation:us-east-1:xxxxxxxxxxxx:stack/CDKToolkit/92106320-ad05-11e9-bffe-0a9fca2e6786", "StackName": "CDKToolkit", "ChangeSetId": "arn:aws:cloudformation:us-east-1:xxxxxxxxxxxx:changeSet/CDK-63a06f96-830e-4f26-b47a-9d2a79fa6ca4/834d5f97-8053-4974-8091-ce0fbac66f72", "Description": "The CDK Toolkit Stack. It was created by `cdk bootstrap` and manages resources necessary for managing your Cloud Applications with AWS CDK.", "CreationTime": "2019-07-23T04:51:44.877Z", "LastUpdatedTime": "2019-07-23T04:51:52.481Z", "RollbackConfiguration": {}, "StackStatus": "CREATE_COMPLETE", "DisableRollback": false, "NotificationARNs": [], "Capabilities": [ "CAPABILITY_IAM", "CAPABILITY_NAMED_IAM", "CAPABILITY_AUTO_EXPAND" ], "Outputs": [ { "OutputKey": "BucketName", "OutputValue": "cdktoolkit-stagingbucket-xxxxxxxxxxxx", "Description": "The name of the S3 bucket owned by the CDK toolkit stack" }, { "OutputKey": "BucketDomainName", "OutputValue": "cdktoolkit-stagingbucket-xxxxxxxxxxxx.s3.amazonaws.com", "Description": "The domain name of the S3 bucket owned by the CDK toolkit stack" } ], "Tags": [], "EnableTerminationProtection": false, "DriftInformation": { "StackDriftStatus": "NOT_CHECKED" } } ] } > aws cloudformation describe-stack-resources \ --stack-name CDKToolkit { "StackResources": [ { "StackName": "CDKToolkit", "StackId": "arn:aws:cloudformation:us-east-1:xxxxxxxxxxxx:stack/CDKToolkit/92106320-ad05-11e9-bffe-0a9fca2e6786", "LogicalResourceId": "StagingBucket", "PhysicalResourceId": "cdktoolkit-stagingbucket-xxxxxxxxxxxx", "ResourceType": "AWS::S3::Bucket", "Timestamp": "2019-07-23T04:52:17.264Z", "ResourceStatus": "CREATE_COMPLETE", "DriftInformation": { "StackResourceDriftStatus": "NOT_CHECKED" } } ] }
準備ができたのでcdk deployでデプロイしてみます。 コマンド実行するとスタックで作成されるロールの情報が表示されて実行するか確認されます。 確認後、CFnにスタック作成されてイベントログが出力されます。わかりやすくていいですね。
> cdk deploy This deployment will make potentially sensitive changes according to your current security approval level (--require-approval broadening). Please confirm you intend to make the following modifications: IAM Statement Changes ┌───┬────────────────────────────────┬────────┬────────────────────────────────┬────────────────────────────────┬───────────┐ │ │ Resource │ Effect │ Action │ Principal │ Condition │ ├───┼────────────────────────────────┼────────┼────────────────────────────────┼────────────────────────────────┼───────────┤ │ + │ ${AWS679f53fac002430cb0da5b798 │ Allow │ sts:AssumeRole │ Service:lambda.${AWS::URLSuffi │ │ │ │ 2bd2287/ServiceRole.Arn} │ │ │ x} │ │ ├───┼────────────────────────────────┼────────┼────────────────────────────────┼────────────────────────────────┼───────────┤ │ + │ * │ Allow │ managedblockchain:GetNetwork │ AWS:${AWS679f53fac002430cb0da5 │ │ │ │ │ │ │ b7982bd2287/ServiceRole} │ │ └───┴────────────────────────────────┴────────┴────────────────────────────────┴────────────────────────────────┴───────────┘ IAM Policy Changes ┌───┬───────────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────┐ │ │ Resource │ Managed Policy ARN │ ├───┼───────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────┤ │ + │ ${AWS679f53fac002430cb0da5b7982bd2287/ServiceRole} │ arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLam │ │ │ │ bdaBasicExecutionRole │ └───┴───────────────────────────────────────────────────────────┴───────────────────────────────────────────────────────────┘ (NOTE: There may be security-related changes not in this list. See http://bit.ly/cdk-2EhF7Np) Do you wish to deploy these changes (y/n)? y UseCdkCustomResourcesStack: deploying... UseCdkCustomResourcesStack: creating CloudFormation changeset... 0/6 | 16:09:48 | CREATE_IN_PROGRESS | AWS::IAM::Role | AWS679f53fac002430cb0da5b7982bd2287/ServiceRole (AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2) 0/6 | 16:09:48 | CREATE_IN_PROGRESS | AWS::CDK::Metadata | CDKMetadata 0/6 | 16:09:48 | CREATE_IN_PROGRESS | AWS::IAM::Role | AWS679f53fac002430cb0da5b7982bd2287/ServiceRole (AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2) Resource creation Initiated 0/6 | 16:09:50 | CREATE_IN_PROGRESS | AWS::CDK::Metadata | CDKMetadata Resource creation Initiated 1/6 | 16:09:50 | CREATE_COMPLETE | AWS::CDK::Metadata | CDKMetadata 2/6 | 16:10:01 | CREATE_COMPLETE | AWS::IAM::Role | AWS679f53fac002430cb0da5b7982bd2287/ServiceRole (AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2) 2/6 | 16:10:05 | CREATE_IN_PROGRESS | AWS::IAM::Policy | AWS679f53fac002430cb0da5b7982bd2287/ServiceRole/DefaultPolicy (AWS679f53fac002430cb0da5b7982bd2287ServiceRoleDefaultPolicyD28E1A5E) 2/6 | 16:10:08 | CREATE_IN_PROGRESS | AWS::IAM::Policy | AWS679f53fac002430cb0da5b7982bd2287/ServiceRole/DefaultPolicy (AWS679f53fac002430cb0da5b7982bd2287ServiceRoleDefaultPolicyD28E1A5E) Resource creation Initiated 3/6 | 16:10:13 | CREATE_COMPLETE | AWS::IAM::Policy | AWS679f53fac002430cb0da5b7982bd2287/ServiceRole/DefaultPolicy (AWS679f53fac002430cb0da5b7982bd2287ServiceRoleDefaultPolicyD28E1A5E) 3/6 | 16:10:16 | CREATE_IN_PROGRESS | AWS::Lambda::Function | AWS679f53fac002430cb0da5b7982bd2287 (AWS679f53fac002430cb0da5b7982bd22872D164C4C) 3/6 | 16:10:16 | CREATE_IN_PROGRESS | AWS::Lambda::Function | AWS679f53fac002430cb0da5b7982bd2287 (AWS679f53fac002430cb0da5b7982bd22872D164C4C) Resource creation Initiated 4/6 | 16:10:16 | CREATE_COMPLETE | AWS::Lambda::Function | AWS679f53fac002430cb0da5b7982bd2287 (AWS679f53fac002430cb0da5b7982bd22872D164C4C) 4/6 | 16:10:22 | CREATE_IN_PROGRESS | Custom::AWS | getNetworkTest/Resource/Default (getNetworkTest425BEE14) 4/6 | 16:10:27 | CREATE_IN_PROGRESS | Custom::AWS | getNetworkTest/Resource/Default (getNetworkTest425BEE14) Resource creation Initiated 5/6 | 16:10:27 | CREATE_COMPLETE | Custom::AWS | getNetworkTest/Resource/Default (getNetworkTest425BEE14) 6/6 | 16:10:29 | CREATE_COMPLETE | AWS::CloudFormation::Stack | UseCdkCustomResourcesStack
Tumblr media
UseCdkCustomResourcesStack Outputs: UseCdkCustomResourcesStack.BcNetworkId = n-XXXXXXXXXXXXXXXXXXXXXXXXXX Stack ARN: arn:aws:cloudformation:us-east-1:xxxxxxxxxxxx:stack/UseCdkCustomResourcesStack/ca79efc0-ad18-11e9-8a12-0a3a983b5e88
スタック作成されるとOutputs情報も出力され、AMBネットワーク情報が取得できたのを確認できます。 CFnスタック情報を確認してみるとParametersが設定されていたり、AWS::CDK::MetadataリソースなどAWS CDK特有のリソースがあったりします。
> aws cloudformation describe-stacks \ --stack-name UseCdkCustomResourcesStack { "Stacks": [ { "StackId": "arn:aws:cloudformation:us-east-1:xxxxxxxxxxxx:stack/UseCdkCustomResourcesStack/7d97bb10-ae85-11e9-93b7-0a51b82e168a", "StackName": "UseCdkCustomResourcesStack", "ChangeSetId": "arn:aws:cloudformation:us-east-1:xxxxxxxxxxxx:changeSet/CDK-8a18b8d3-a2c2-4095-8f99-1c3da69255a2/3ad6c643-6d89-4e96-9cf9-5403bff5b01e", "Parameters": [ { "ParameterKey": "AWS679f53fac002430cb0da5b7982bd2287CodeS3BucketF55839B6", "ParameterValue": "cdktoolkit-stagingbucket-xxxxxxxxxxxx" }, { "ParameterKey": "AWS679f53fac002430cb0da5b7982bd2287CodeS3VersionKey3C45B02F", "ParameterValue": "assets/UseCdkCustomResourcesStackAWS679f53fac002430cb0da5b7982bd2287Code44CF678B/||6d3e1aface6af068a2d1abe48f7aa26b140d9231a6078e03e076239b8189ae2a.zip" }, { "ParameterKey": "AWS679f53fac002430cb0da5b7982bd2287CodeArtifactHash49FACC2E", "ParameterValue": "6d3e1aface6af068a2d1abe48f7aa26b140d9231a6078e03e076239b8189ae2a" } ], "CreationTime": "2019-07-25T02:39:57.405Z", "LastUpdatedTime": "2019-07-25T02:40:05.168Z", "RollbackConfiguration": {}, "StackStatus": "CREATE_COMPLETE", "DisableRollback": false, "NotificationARNs": [], "Capabilities": [ "CAPABILITY_IAM", "CAPABILITY_NAMED_IAM", "CAPABILITY_AUTO_EXPAND" ], "Outputs": [ { "OutputKey": "BcNetworkId", "OutputValue": "n-XXXXXXXXXXXXXXXXXXXXXXXXXX", "Description": "The message that came back from the Custom Resource" } ], "Tags": [], "EnableTerminationProtection": false, "DriftInformation": { "StackDriftStatus": "NOT_CHECKED" } } ] } > aws cloudformation describe-stack-resources \ --stack-name UseCdkCustomResourcesStack \ --query "StackResources[*].ResourceType" [ "AWS::Lambda::Function", "AWS::IAM::Role", "AWS::IAM::Policy", "AWS::CDK::Metadata", "Custom::AWS" ]
のぞいてみる
AWS CDKのデプロイ時に作成されるファイルをのぞいてみました。 npm run buildコマンドでjsファイルが作成されています。 cdk deployコマンドでcdk.outフォルダが生成され、こちらにCFn関連のファイルが作成されています。
> tree . -L 2 . ├── README.md ├── bin │ ├── use-cdk-custom-resources.d.ts │ ├── use-cdk-custom-resources.js │ └── use-cdk-custom-resources.ts ├── cdk.json ├── cdk.out │ ├── UseCdkCustomResourcesStack.template.json │ ├── asset.01d077466681f165ec462417f525188e4be806c35136c1a5e4bdcd3b71c12942 │ ├── cdk.out │ └── manifest.json ├── lib │ ├── use-cdk-custom-resources-stack.d.ts │ ├── use-cdk-custom-resources-stack.js │ └── use-cdk-custom-resources-stack.ts ├── node_modules (略) ├── package-lock.json ├── package.json └── tsconfig.json 212 directories, 19 files
cdk.out/asset.xxxxxフォルダにindex.jsファイルがあり、これがCFnのLambda-Backedカスタムリソースで利用されるLambda関数のファイルになるみたいです。
> tree cdk.out -L 2 cdk.out ├── UseCdkCustomResourcesStack.template.json ├── asset.01d077466681f165ec462417f525188e4be806c35136c1a5e4bdcd3b71c12942 │ ├── index.d.ts │ └── index.js ├── cdk.out └── manifest.json
cdk.out/asset.xxxxx/index.jsをみてみるとflattenメソッドっていうAWS SDKから得られたJSONファイルをフラット化する実装があったりします。 なぜJSONファイルをフラット化する必要があるかは下記が詳しいです。
AWS CloudFormationのLambda-BackedカスタムリソースでネストされたJSONを返しても参照できない – Qiita https://cloudpack.media/48318
AWS CloudFormationのLambda-BackedカスタムリソースでネストされてるっぽいJSONを返す方法 – Qiita https://cloudpack.media/48329
AWS SDKの利用方法もconst awsService = new AWS[call.service](call.apiVersion && { apiVersion: call.apiVersion });って呼び方ができるのかぁ。など参考になります。
cdk.out/asset.xxxxx/index.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // tslint:disable:no-console const AWS = require("aws-sdk"); /** * Flattens a nested object * * @param object the object to be flattened * @returns a flat object with path as keys */ function flatten(object) { return Object.assign({}, ...function _flatten(child, path = []) { return [].concat(...Object.keys(child) .map(key => typeof child[key] === 'object' ? _flatten(child[key], path.concat([key])) : ({ [path.concat([key]).join('.')]: child[key] }))); }(object)); } /** * Converts true/false strings to booleans in an object */ function fixBooleans(object) { return JSON.parse(JSON.stringify(object), (_k, v) => v === 'true' ? true : v === 'false' ? false : v); } /** * Filters the keys of an object. */ function filterKeys(object, pred) { return Object.entries(object) .reduce((acc, [k, v]) => pred(k) ? { ...acc, [k]: v } : acc, {}); } async function handler(event, context) { try { console.log(JSON.stringify(event)); console.log('AWS SDK VERSION: ' + AWS.VERSION); let physicalResourceId = event.PhysicalResourceId; let flatData = {}; let data = {}; const call = event.ResourceProperties[event.RequestType]; if (call) { const awsService = new AWS[call.service](call.apiVersion && { apiVersion: call.apiVersion }); try { const response = await awsService[call.action](call.parameters && fixBooleans(call.parameters)).promise(); flatData = flatten(response); data = call.outputPath ? filterKeys(flatData, k => k.startsWith(call.outputPath)) : flatData; } catch (e) { if (!call.catchErrorPattern || !new RegExp(call.catchErrorPattern).test(e.code)) { throw e; } } physicalResourceId = call.physicalResourceIdPath ? flatData[call.physicalResourceIdPath] : call.physicalResourceId; } await respond('SUCCESS', 'OK', physicalResourceId, data); } catch (e) { console.log(e); await respond('FAILED', e.message || 'Internal Error', context.logStreamName, {}); } function respond(responseStatus, reason, physicalResourceId, data) { const responseBody = JSON.stringify({ Status: responseStatus, Reason: reason, PhysicalResourceId: physicalResourceId, StackId: event.StackId, RequestId: event.RequestId, LogicalResourceId: event.LogicalResourceId, NoEcho: false, Data: data }); console.log('Responding', responseBody); const parsedUrl = require('url').parse(event.ResponseURL); const requestOptions = { hostname: parsedUrl.hostname, path: parsedUrl.path, method: 'PUT', headers: { 'content-type': '', 'content-length': responseBody.length } }; return new Promise((resolve, reject) => { try { const request = require('https').request(requestOptions, resolve); request.on('error', reject); request.write(responseBody); request.end(); } catch (e) { reject(e); } }); } } exports.handler = handler; //# sourceMappingURL=data:application/json;base64,eyJ2(略)
cdk.out/manifest.jsonファイルがCFnでスタック作成する際のテンプレートになっています。 リソース名にランダムな英数字が含まれているので、扱うリソースが増えるとなかなかに読み応えがありそうです(白目
おもしろいなぁと感じたのは、AWS SDKのサービス名とアクション(メソッド) = AWS::IAM::Policyのアクションになる点です。
今回はAMBのgetNetworkを利用しているので、
AWS SDKのメソッド呼び出し: new AWS['ManagedBlockchain']['getNetwork'](parameters)
AWS::IAM::Policyのアクション: managedblockchain:GetNetwork
となります。
cdk.out/manifest.json
{ "Resources": { "getNetworkTest425BEE14": { "Type": "Custom::AWS", "Properties": { "ServiceToken": { "Fn::GetAtt": [ "AWS679f53fac002430cb0da5b7982bd22872D164C4C", "Arn" ] }, "Create": { "service": "ManagedBlockchain", "action": "getNetwork", "parameters": { "NetworkId": "n-XXXXXXXXXXXXXXXXXXXXXXXXXX" }, "physicalResourceIdPath": "Network.Id" } }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete", "Metadata": { "aws:cdk:path": "UseCdkCustomResourcesStack/getNetworkTest/Resource/Default" } }, "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { "Statement": [ { "Action": "sts:AssumeRole", "Effect": "Allow", "Principal": { "Service": { "Fn::Join": [ "", [ "lambda.", { "Ref": "AWS::URLSuffix" } ] ] } } } ], "Version": "2012-10-17" }, "ManagedPolicyArns": [ { "Fn::Join": [ "", [ "arn:", { "Ref": "AWS::Partition" }, ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } ] }, "Metadata": { "aws:cdk:path": "UseCdkCustomResourcesStack/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole/Resource" } }, "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleDefaultPolicyD28E1A5E": { "Type": "AWS::IAM::Policy", "Properties": { "PolicyDocument": { "Statement": [ { "Action": "managedblockchain:GetNetwork", "Effect": "Allow", "Resource": "*" } ], "Version": "2012-10-17" }, "PolicyName": "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleDefaultPolicyD28E1A5E", "Roles": [ { "Ref": "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" } ] }, "Metadata": { "aws:cdk:path": "UseCdkCustomResourcesStack/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole/DefaultPolicy/Resource" } }, "AWS679f53fac002430cb0da5b7982bd22872D164C4C": { "Type": "AWS::Lambda::Function", "Properties": { "Code": { "S3Bucket": { "Ref": "AWS679f53fac002430cb0da5b7982bd2287CodeS3BucketF55839B6" }, "S3Key": { "Fn::Join": [ "", [ { "Fn::Select": [ 0, { "Fn::Split": [ "||", { "Ref": "AWS679f53fac002430cb0da5b7982bd2287CodeS3VersionKey3C45B02F" } ] } ] }, { "Fn::Select": [ 1, { "Fn::Split": [ "||", { "Ref": "AWS679f53fac002430cb0da5b7982bd2287CodeS3VersionKey3C45B02F" } ] } ] } ] ] } }, "Handler": "index.handler", "Role": { "Fn::GetAtt": [ "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2", "Arn" ] }, "Runtime": "nodejs10.x" }, "DependsOn": [ "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleDefaultPolicyD28E1A5E", "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" ], "Metadata": { "aws:cdk:path": "UseCdkCustomResourcesStack/AWS679f53fac002430cb0da5b7982bd2287/Resource", "aws:asset:path": "asset.01d077466681f165ec462417f525188e4be806c35136c1a5e4bdcd3b71c12942", "aws:asset:property": "Code" } } }, "Parameters": { "AWS679f53fac002430cb0da5b7982bd2287CodeS3BucketF55839B6": { "Type": "String", "Description": "S3 bucket for asset \"UseCdkCustomResourcesStack/AWS679f53fac002430cb0da5b7982bd2287/Code\"" }, "AWS679f53fac002430cb0da5b7982bd2287CodeS3VersionKey3C45B02F": { "Type": "String", "Description": "S3 key for asset version \"UseCdkCustomResourcesStack/AWS679f53fac002430cb0da5b7982bd2287/Code\"" }, "AWS679f53fac002430cb0da5b7982bd2287CodeArtifactHash49FACC2E": { "Type": "String", "Description": "Artifact hash for asset \"UseCdkCustomResourcesStack/AWS679f53fac002430cb0da5b7982bd2287/Code\"" } }, "Outputs": { "BcNetworkId": { "Description": "The message that came back from the Custom Resource", "Value": { "Fn::GetAtt": [ "getNetworkTest425BEE14", "Network.Id" ] } } } }
Lambda-Backedカスタムリソースで利用されてるLambda関数の実行ログをみてみます。
> aws logs get-log-events \ --log-group-name /aws/lambda/UseCdkCustomResourcesStac-AWS679f53fac002430cb0da5-2LAVFV782HQ4 \ --log-stream-name '2019/07/25/[$LATEST]3954b08a05354dcf97a63939586c5575' \ --query "events[*].message" [ "START RequestId: 44b992e7-fb71-4c19-bf44-af78d7f79520 Version: $LATEST\n", "2019-07-25T02:41:05.271Z\t44b992e7-fb71-4c19-bf44-af78d7f79520\tINFO\t{\"RequestType\":\"Create\",\"ServiceToken\":\"arn:aws:lambda:us-east-1:xxxxxxxxxxxx:function:UseCdkCustomResourcesStac-AWS679f53fac002430cb0da5-2LAVFV782HQ4\",\"ResponseURL\":\"https://cloudformation-custom-resource-response-useast1.s3.amazonaws.com/(略)\",\"StackId\":\"arn:aws:cloudformation:us-east-1:xxxxxxxxxxxx:stack/UseCdkCustomResourcesStack/7d97bb10-ae85-11e9-93b7-0a51b82e168a\",\"RequestId\":\"73e446ee-e9e6-4d7d-9e5f-fd400865dec6\",\"LogicalResourceId\":\"getNetworkTest425BEE14\",\"ResourceType\":\"Custom::AWS\",\"ResourceProperties\":{\"ServiceToken\":\"arn:aws:lambda:us-east-1:xxxxxxxxxxxx:function:UseCdkCustomResourcesStac-AWS679f53fac002430cb0da5-2LAVFV782HQ4\",\"Create\":{\"service\":\"ManagedBlockchain\",\"action\":\"getNetwork\",\"physicalResourceIdPath\":\"Network.Id\",\"parameters\":{\"NetworkId\":\"n-XXXXXXXXXXXXXXXXXXXXXXXXXX\"}}}}\n", "2019-07-25T02:41:05.272Z\t44b992e7-fb71-4c19-bf44-af78d7f79520\tINFO\tAWS SDK VERSION: 2.488.0\n", "2019-07-25T02:41:06.112Z\t44b992e7-fb71-4c19-bf44-af78d7f79520\tINFO\tResponding {\"Status\":\"SUCCESS\",\"Reason\":\"OK\",\"PhysicalResourceId\":\"n-XXXXXXXXXXXXXXXXXXXXXXXXXX\",\"StackId\":\"arn:aws:cloudformation:us-east-1:xxxxxxxxxxxx:stack/UseCdkCustomResourcesStack/7d97bb10-ae85-11e9-93b7-0a51b82e168a\",\"RequestId\":\"73e446ee-e9e6-4d7d-9e5f-fd400865dec6\",\"LogicalResourceId\":\"getNetworkTest425BEE14\",\"NoEcho\":false,\"Data\":{\"Network.Id\":\"n-XXXXXXXXXXXXXXXXXXXXXXXXXX\",\"Network.Name\":\"TestNetwork\",\"Network.Description\":\"TestNetworkDescription\",\"Network.Framework\":\"HYPERLEDGER_FABRIC\",\"Network.FrameworkVersion\":\"1.2\",\"Network.FrameworkAttributes.Fabric.OrderingServiceEndpoint\":\"orderer.n-XXXXXXXXXXXXXXXXXXXXXXXXXX.managedblockchain.us-east-1.amazonaws.com:30001\",\"Network.FrameworkAttributes.Fabric.Edition\":\"STARTER\",\"Network.VpcEndpointServiceName\":\"com.amazonaws.us-east-1.managedblockchain.n-XXXXXXXXXXXXXXXXXXXXXXXXXX\",\"Network.VotingPolicy.ApprovalThresholdPolicy.ThresholdPercentage\":50,\"Network.VotingPolicy.ApprovalThresholdPolicy.ProposalDurationInHours\":24,\"Network.VotingPolicy.ApprovalThresholdPolicy.ThresholdComparator\":\"GREATER_THAN\",\"Network.Status\":\"AVAILABLE\"}}\n", "END RequestId: 44b992e7-fb71-4c19-bf44-af78d7f79520\n", "REPORT RequestId: 44b992e7-fb71-4c19-bf44-af78d7f79520\tDuration: 1159.89 ms\tBilled Duration: 1200 ms \tMemory Size: 128 MB\tMax Memory Used: 38 MB\t\n" ]
ログに出力されてるCFnへ返すJSONをみてみるとDataがAWS SDKのgetNetworkで得られる情報となりフラット化されているのが確認できます。
ログ一部抜粋
{ "Status": "SUCCESS", "Reason": "OK", "PhysicalResourceId": "n-XXXXXXXXXXXXXXXXXXXXXXXXXX", "StackId": "arn:aws:cloudformation:us-east-1:xxxxxxxxxxxx:stack/UseCdkCustomResourcesStack/7d97bb10-ae85-11e9-93b7-0a51b82e168a", "RequestId": "73e446ee-e9e6-4d7d-9e5f-fd400865dec6", "LogicalResourceId": "getNetworkTest425BEE14", "NoEcho": false, "Data": { "Network.Id": "n-XXXXXXXXXXXXXXXXXXXXXXXXXX", "Network.Name": "TestNetwork", "Network.Description": "TestNetworkDescription", "Network.Framework": "HYPERLEDGER_FABRIC", "Network.FrameworkVersion": "1.2", "Network.FrameworkAttributes.Fabric.OrderingServiceEndpoint": "orderer.n-XXXXXXXXXXXXXXXXXXXXXXXXXX.managedblockchain.us-east-1.amazonaws.com:30001", "Network.FrameworkAttributes.Fabric.Edition": "STARTER", "Network.VpcEndpointServiceName": "com.amazonaws.us-east-1.managedblockchain.n-XXXXXXXXXXXXXXXXXXXXXXXXXX", "Network.VotingPolicy.ApprovalThresholdPolicy.ThresholdPercentage": 50, "Network.VotingPolicy.ApprovalThresholdPolicy.ProposalDurationInHours": 24, "Network.VotingPolicy.ApprovalThresholdPolicy.ThresholdComparator": "GREATER_THAN", "Network.Status": "AVAILABLE" } }
動作確認ができてスタックが不要になったらcdk destroyコマンドでスタック削除ができます。
> cdk destroy Are you sure you want to delete: UseCdkCustomResourcesStack (y/n)? y UseCdkCustomResourcesStack: destroying...
✅ UseCdkCustomResourcesStack: destroyed
cdk bootstrapで作成されたスタックを削除するAWS CDKのコマンドは見当たらないのでAWS CDKを今後利用しないのであれば、CFnでCDKToolkitスタックを削除すればよさそうです。
まとめ
実際に動かして出力されるファイルやログを確認することで、AWS CDKがどのように機能しているのか知ることができました。 Infrastructure as Codeが主流になるとするならば、AWS CDKは抑えておいて損はないかなと思います。
参考
AWS クラウド開発キット (CDK) – TypeScript と Python 用がご利用可能に | Amazon Web Services ブログ https://aws.amazon.com/jp/blogs/news/aws-cloud-development-kit-cdk-typescript-and-python-are-now-generally-available/
aws-cdk-examples/index.ts at master · aws-samples/aws-cdk-examples https://github.com/aws-samples/aws-cdk-examples/blob/master/typescript/lambda-cron/index.ts
aws-cdk/packages/@aws-cdk/custom-resources at master · aws/aws-cdk https://github.com/aws/aws-cdk/tree/master/packages/%40aws-cdk/custom-resources
aws-cdk/packages/@aws-cdk/aws-cloudformation at master · aws/aws-cdk https://github.com/aws/aws-cdk/tree/master/packages/%40aws-cdk/aws-cloudformation
Amazon Managed BlockchainでHyperledger Fabricのブロックチェーンネットワークをさくっと構築するAWS CloudFormationのテンプレートを作ってみた(使い方編) – Qiita https://cloudpack.media/48077
Amazon Managed BlockchainでHyperledger Fabricのブロックチェーンネットワークをさくっと構築するAWS CloudFormationのテンプレートを作ってみた(解説編) – Qiita https://cloudpack.media/48440
AWS CloudFormationのLambda-BackedカスタムリソースでネストされたJSONを返しても参照できない – Qiita https://cloudpack.media/48318
AWS CloudFormationのLambda-BackedカスタムリソースでネストされてるっぽいJSONを返す方法 – Qiita https://cloudpack.media/48329
元記事はこちら
「AWS Cloud Development Kit(AWS CDK)でカスタムリソース(@aws-cdk/custom-resources)をつかってみた」
August 26, 2019 at 02:00PM
0 notes
udemy-gift-coupon-blog · 6 years ago
Link
The Complete Hyperledger Fabric Fundamentals ##100%FREEUdemyDiscountCoupons ##Edx #Complete #Fabric #Fundamentals #Hyperledger The Complete Hyperledger Fabric Fundamentals Learn from the industry experts! Learn the key concepts of Hyperledger Fabric in depth and in the most simplest terms. Welcome to the Complete Hyperledger Fabric Fundamentals Course. People have heard about Hyperledger Fabric but they don't know what it is. This course has been designed in such a way that you will get a thorough understanding of how the Hyperledger Fabric Technology is being used as a solution to various problems being faced by the industries. This is a very comprehensive course which explains all the basics and fundamentals of Hyperledger Fabric in the simplest way. This is not a Developer's course, this course is created in order to clear all the basic concepts and fundamentals of Hyperledger Fabric. We will be coming out with a Hyperledger Developer's course soon. In 2018, the rise in jobs in the Blockchain sector has been 7000%. For every 14 jobs in the USA, there is only 1 person who is available to take up job in Blockchain Technology. Hyperledger Fabric is a solution which is at the top of the curve for the governments and the enterprises. Industries like Walmart, McDonalds, Nestle, Dole etc. have already implemented Hyperledger Fabric and many more are seeking the help of Hyperledger Platform to solve their problems and get an efficient solution. What you will you get with this course: In order to make this course more interactive, we have provided various quizzes as a part of the modules. You will get more clarity and will be able to master all the important topics related to Hyperledger Fabric. What we cover in this course: · Overview of different projects under the Hyperledger Umbrella · Introduction to Hyperledger Habric · Key Functionalities offered by Hyperledger Fabric · Key Concepts of Hyperledger Fabric · Certificate Authorities and Membership Service Provider · Committing Peers, Endorsing Peers and Orderers · Channels and Private Data Collections ·  Transaction and Endorsement Flow ·  Hyperledger Fabric Architecture ·  Endorsement Polices ·  Gossip Protocol Bonus material we provide: · Various examples have been provided to understand how Hyperledger Fabric works in the practical scenarios · A peek at the pros and cons of Hyperledger Fabric We2Blocks is a Blockchain Consultation and Training Company having a global presence. With this course we aim to promote Blockchain and create an environment for people interested in Blockchain to learn and expand their knowledge. 👉 Activate Udemy Coupon 👈 Free Tutorials Udemy Review Real Discount Udemy Free Courses Udemy Coupon Udemy Francais Coupon Udemy gratuit Coursera and Edx ELearningFree Course Free Online Training Udemy Udemy Free Coupons Udemy Free Discount Coupons Udemy Online Course Udemy Online Training 100% FREE Udemy Discount Coupons https://www.couponudemy.com/blog/the-complete-hyperledger-fabric-fundamentals/
0 notes
icodogio · 6 years ago
Text
Want to Become a Blockchain Developer? Check out our tips
Blockchain development is a skill few have at the moment, many want to learn and the others without a clue on what blockchains actually are. With the supply/demand ratio of blockchain jobs at a high of 14 jobs per blockchain developer and salaries above $100,000 USD, more developers are needed in the field. This article highlights what you need to start the process of learning blockchain technology and how to become a top blockchain developer in the future.
Decentralized technologies such as blockchains are gaining massive coverage and attention from big corporations and institutions across the world. If you followed keenly the cryptocurrency market during the massive soar in price in late 2017 and the following bear reversal for the rest of 2018, one thing was clear: development of blockchains was at an all-time high.
Average salaries for blockchain developers in Q1 2018
In addition, reports from Upwork revealed blockchain as the fastest growing skill on the site for the first quarter of 2018. The field grew massively during the first months of 2018 placing it top of the 5000+ categories of jobs listed on the site. This represents a 6000% increase in number of blockchain jobs listed over the same period in Q1 2017.
The field grows by the day as institutions continue searching for blockchain developers and coders to add to their ranks. Big corporations such as JP Morgan, IBM, Samsung, Audi and other big industry players are focusing on this new wave of technology.
Top wanted blockchain development skills
Solidity: The Ethereum coding language popularized smart contract development and is widely used to create dApps on the Ethereum blockchain.
Hyperledger Fabric: an enterprise blockchain framework focused on modularity and scalability to support the often changed business rules.
Ripple: The cross boarder payments settlement platform is charming more developers towards blockchain too.
Here are some points to note before starting the journey towards being a top blockchain developer.
What’s important to learn?
Before starting the journey towards becoming a top developer, there are some essential rules you should take note of including;
Blockchain development is time intensive and requires you to take hours of practice to learn the skill. Furthermore, you will need resources to enroll for classes on blockchain development too.
Prior knowledge in coding languages such as Python, C++, and others is needed as blockchains are developed using these coding languages.
Do not expect instant results. Blockchain development requires years of practice to become a fully -fledged developer in the field, it is not an instant pill.
Steps to becoming a blockchain developer
1. Understanding the basics of blockchain
For any new concept, such as blockchain technology, it is crucial to familiarize yourself with the words and jargon in the field to avoid missing key pointers. For beginners, the need to learn the technical terminologies in the field is fundamental to ease their access into blockchain development. The knowledge of blockchain terms such as blockchain, consensus mechanisms, decentralized systems, mining, smart contracts and public & private cryptographic keys.
To build a technical application on top of the blockchain, developers have to learn the crypto economics that runs the projects as well. Most developers focus on the cryptographic part of the equation leaving out the economics part. This leads to poor development of the application which misses key links to making the ICO work. Learning specifics of the blockchain development process will further require you to be familiar with other technical progressions in the field such as raising an ICO, security tokens, and stablecoins among others.
Final step to understanding the basics of blockchain development is reading Satoshi Nakamoto’s first Bitcoin whitepaper. The whitepaper titled, “Bitcoin: A Peer-to-Peer Electronic Cash System”, explains the process of developing bitcoin, the first cryptocurrency in the world.
2. Learn how blockchains work
Once you are familiar with the basic terminologies in blockchain, you will need to acquaint yourself with the practical ways the blockchains actually work. One of the most common ways to learn how blockchain works is by purchasing a few coins from the various cryptocurrency exchanges available. (Read this guide on how to avoid major cryptocurrency scams while making your investment.)
The next step is getting a cryptocurrency wallet and learning how the wallet works. There are different types of wallets offering security and convenience at different levels such as online wallets, paper wallets and cold storage wallets. For small amounts and ease of trading on exchanges, the online exchanges offer better convenience but are susceptible to security breaches. Cold storage wallets offer the best options to securely store your coins.
Learn more on how blockchain technology works in this article.
3. The coding Tutorial
Before you start to code, it is imperative to note that the creation and maintenance of the blockchain is not easy. A couple of challenges increases the difficulty to keep open sourced blockchains secure and block off hacks on the system.
Security: One of the challenges that faces creation and management of blockchain networks is the open sourced nature that allows the public to check for bugs and vulnerabilities. If the bugs and vulnerabilities are revealed by unethical hackers, the system faces a possible wipe off of funds from the system. Hence, developers should keep checking their blockchain to avoid any security breaches.
Implementation of the blockchain: The decentralized nature of blockchains offers a performance conundrum for the developers. The language used to develop the blockchain has to be versatile enough to allow max performance of the platform.
Deterministic behavior: In blockchain development, all transaction operations must be deterministic. You cannot have a transaction that behaves one way and then behaves another way the next day. Similarly, you cannot have smart contracts that work in two different ways on two different machines.
4. Creating your blockchain
Components of a block
 (This section is collaboratively created with team from DLBRT)
Cryptographic hash: This is a mathematical algorithm that maps data of arbitrary size to a bit string of a fixed size (a hash) and is designed to be a one-way function, that is, a function which is infeasible to invert. The only way to recreate the input data is to attempt a brute-force search of possible inputs to see if they produce a match. The input data is often called the message, and the output the hash value or hash sum, message digest or the digest.
Previous block cryptographic hash
A timestamp: Shows the time the block was created.
Transaction data: Every block has data on the transactions that are represented as a merkle tree root hash.
A blockchain is formed by linking the blocks created securely using cryptographic hashes. It is created by adding blocks to the genesis block and validating the chain.
Remember, blockchain development requires a strong background in blockchain friendly languages such as C++, Python, Go, C# etc.
5. Learning smart contracts
“A computer protocol intended to facilitate, verify, or enforce the negotiation or performance of a contract.” – Wikipedia
Anything that runs on a blockchain needs to be immutable and must have the ability to run through multiple nodes without compromising on its integrity. This means that users have to learn the ins and outs of smart contracts to ensure they fulfill three conditions; deterministic, terminable and isolated.
  Completing the steps above is the first step towards becoming a fully-fledged blockchain developer in 2019. Practice makes perfect in the field hence you will need to put in the hours. It is best advised for beginners to take up online classes, or MOOC classes to better their knowledge in the field of blockchain development.
                      The post Want to Become a Blockchain Developer? Check out our tips appeared first on ICODOG.
source https://icodog.io/guide/want-to-become-a-blockchain-developer/
0 notes
gilberthbolanos · 6 years ago
Text
Installing a blockchain network using Hyperledger Fabric and Composer[Tutorial]
source: Block Chain today same now This article is an excerpt taken from the book Hands-On IoT Solutions with Blockchain written by Maximiliano Santos and Enio Moura. In this book … Installing a blockchain network using Hyperledger Fabric and Composer[Tutorial]
View On WordPress
0 notes
test4master-blog · 7 years ago
Text
blockchain tutorial in delhi
This blockchain tutorial in delhi from test4master in Delhi has been designed by the fabrication authority to give you hands-on understanding of. You will master the mixed detail of blockchain technology, the different solicitation of blockchain like exquisite and bitcoin, mining for bitcoin, blockchain developer skills, consequence of peer-to-peer network and more. Work on real world projects and case studies.test4master offers the complete training in blockchain technology at New Delhi to help you master this thoroughgoing technology. As part of the training you will learn about the basic and advanced particular of blockchain, situate digital agreement, hyperledger, programming for blockchain and additional.
0 notes